package cn.dglydrpy.study.ssm.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import cn.dglydrpy.study.ssm.dao.entity.Dept;
import cn.dglydrpy.study.ssm.dao.mapper.DeptMapper;
import cn.dglydrpy.study.ssm.service.IDeptService;

@Service
public class DeptService implements IDeptService {
	@Resource//依赖注入
	private DeptMapper deptMapper;

	public void addDept(Dept dept) {
		//调用持久层的方法
		deptMapper.insert(dept);
	}
	
	public void delDept(Integer id){
		deptMapper.delete(id);
	}
	
	public List<Dept> showAll(){
		return deptMapper.selectAll();
	}
	
	public Dept showById(Integer id){
		return deptMapper.selectById(id);
	}
	
	public void updateDept(Dept dept){
		deptMapper.update(dept);
	}
}
